package com.gopay.gass.service.impl.bank;

import java.math.BigDecimal;

import org.springframework.stereotype.Service;

import com.gopay.common.domain.bank.BcdlMessage;
import com.gopay.gass.constants.SameBank;
import com.gopay.gass.domain.GassMainOrder;
import com.gopay.gass.domain.GassOrderDtl;
import com.gopay.gass.service.impl.GassPayRequestServiceImpl;

/**
 * 大额跨行转账
 * @author p.lian
 *
 */
@Service("icbccrossGassPayRequestService")
public class ICBCCROSSGassPayRequestServiceImpl extends
		GassPayRequestServiceImpl {

	@Override
	protected BcdlMessage buildBcdlMessage(GassMainOrder main, GassOrderDtl dtl) {
		// TODO Auto-generated method stub
		BcdlMessage message = super.createBaseBcdlMessage(main, dtl);
        message.setPbocBankName(getBankName());
        message.setPobcBankCode("102");
        //设置普通大额对公标识
        //5万元以下“记账处理方式”选择“加急”的指令或5万元以上的指令均走大额支付系统
        if(message.getAmount().compareTo(new BigDecimal("50000.00"))<0){
        	message.setEmergency(0);/* 加急标志 0加急 1不加急 2超级网银*/
        }else{
        	message.setEmergency(1);/* 加急标志 0加急 1不加急 2超级网银*/
        }
        //105100009080 中国建设银行
        //message.setRecvBankCode("105100009080");
        message.setSysIOFlg(2);/* 标记为跨行*/
        //message.setDcblType(Integer.parseInt(BCFlag.BC_FLAG_C.toString()));//对公
		return message;
	}

	@Override
	protected String getBankName() {
		// TODO Auto-generated method stub
		return "中国工商银行";
	}
	
	protected SameBank getSameBank(String recvBankName){
        return SameBank.NO;
    }

}
